#ifndef _NETWORKLIB_H_
#define _NETOWRKLIB_H_
/* A structure that would act as a socket 'object'. */
struct socket_info {
  int socket_fd;
  int (*create_connection) (struct socket_info* , const char* , int ,int );
  int (*close_connection) (struct socket_info* );
  int (*send) (struct socket_info* ,const char*);
  char* (*recv)(struct socket_info* );
};

typedef struct socket_info* sock_info;

/* One function each corresponding  to the func ptrs in the socket_info
   structure. 
*/
int create_conn (sock_info self, const char* ip_addr, int port, int ip_ver);
int close_conn(sock_info self);
int send_data(sock_info self, const char* data);
char* recv_data(sock_info self);

/* Roughly matches the instance creation method in OOP. */
struct socket_info* new_socket();
#endif
